<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box{
            width: 310px;
            display: flex;
            flex-wrap: wrap;
            margin: 0 auto;
        }
        img{
            width: 100px;
            border: 1px solid #ccc;
            opacity:0.5; 
            filter:alpha(opacity=50);
        }
    </style>
</head>
<body>
    <div id="box">
        <img src="./1.jpg" alt="">
        <img src="./1.jpg" alt="">
        <img src="./1.jpg" alt="">
        <img src="./1.jpg" alt="">
        <img src="./1.jpg" alt="">
        <img src="./1.jpg" alt="">
    </div>
</body>
<script>
    window.onload = function(){
        var img = document.getElementsByTagName('img')
        for(var i = 0 ;i < img.length ; i++){
            img[i].onmouseover = function(){
                this.style.cssText = "opacity:1.0;filter:alpha(opacity=100)"
            }
            img[i].onmouseout = function(){
                this.style.cssText = ""
            }
        }
    }
</script>
</html>